import ApiConfig from "../config/config";
// 获取命名空间数据
const getStorage = () => {
    return wx.getStorageSync(ApiConfig.namespace) || {}
}
//获取本地存储数据
const get = (key) => {
    return getStorage()[key]
}
//设置本地存储数据
const set = (key, value) => {
    let storage = getStorage()
    storage[key] = value
    wx.setStorageSync(ApiConfig.namespace, storage);
}

// 删除本地存储的指定数据
const remove = (key) => {
    delete storage[key]
    wx.setStorageSync(ApiConfig.namespace, storage);
}
// 清空本地存储数据
const clear = () => {
    wx.clearStorageSync();
}
export default {
    get,
    set,
    remove,
    clear
}